#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int N = 3010;
const int M = 310;

db dp[M][N],delta[M],las[N],p[N][M],ans;
int n,m;

void DP(){
	for(int i = 1;i <= m;i++){
		dp[i][0] = 1;
		for(int j = 1;j <= n;j++) dp[i][j] = dp[i][j-1] * (1 - p[j][i]);
		delta[i] = 1. - dp[i][n];
	}
}

void update(int x){
	for(int i = 0;i <= n;i++) las[i] = dp[x][i]; dp[x][0] = 0;
	for(int i = 1;i <= n;i++) dp[x][i] = dp[x][i-1] * (1 - p[i][x]) + las[i-1] * p[i][x];
	delta[x] -= dp[x][n];
}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in,m = in;
	for(int i = 1;i <= n;i++) for(int j = 1;j <= m;j++) p[i][j] = in / 1000.;
	DP();
	for(int i = 1;i <= n;i++){
		int pos = 0;
		for(int j = 1;j <= m;j++)
			if(delta[j] > delta[pos] || !pos) pos = j;
		ans += delta[pos]; update(pos);
	}printf("%.10lf",ans);
	return 0;
}

